package de.luisoft.dto;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class WahlDTO implements Serializable {
	
	private static final long serialVersionUID = 350456020603509793L;

	private String name="", vorname="", klasse="", email="";
	private List<String> select;
	
    private int id;	
	
    public WahlDTO() {};
    public WahlDTO(String name, String[] select) {
    	this.name = name;
    	this.select = new ArrayList(Arrays.asList(select));
    };

	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getVorname() {
		return vorname;
	}
	public void setVorname(String vorname) {
		this.vorname = vorname;
	}
	public String getKlasse() {
		return klasse;
	}
	public void setKlasse(String klasse) {
		this.klasse = klasse;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public List<String> getSelect() {
		return select;
	}
	public void setSelect(List<String> select) {
		this.select = select;
	}
	
	public String toString() {
		return vorname + " " + name + "(" + klasse + ")";
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((email == null) ? 0 : email.toLowerCase().hashCode());
		result = prime * result + ((klasse == null) ? 0 : klasse.toLowerCase().hashCode());
		result = prime * result + ((name == null) ? 0 : name.toLowerCase().hashCode());
		result = prime * result + ((vorname == null) ? 0 : vorname.toLowerCase().hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		WahlDTO other = (WahlDTO) obj;
		if (email == null) {
			if (other.email != null)
				return false;
		} else if (!email.equalsIgnoreCase(other.email))
			return false;
		if (klasse == null) {
			if (other.klasse != null)
				return false;
		} else if (!klasse.equalsIgnoreCase(other.klasse))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equalsIgnoreCase(other.name))
			return false;
		if (vorname == null) {
			if (other.vorname != null)
				return false;
		} else if (!vorname.equalsIgnoreCase(other.vorname))
			return false;
		return true;
	}
	

}
